//
//  MyAdvisoryOrderFinishHeaderCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/4/11.
//  Copyright © 2020 QDSG. All rights reserved.
//

import UIKit

class MyAdvisoryOrderFinishHeaderCell: UITableViewCell {
    
    @IBOutlet weak var businessTypeLabel: UILabel!{
        didSet{
            businessTypeLabel.layer.cornerRadius = 5
            businessTypeLabel.layer.masksToBounds = true
        }
    }
    
    func updateData(vm: MyAdvisoryOrderFinishViewModel) {
        avatarImgVieiw.kf.setImage(with: URL(string: vm.avatar), placeholder: UIImage(named: "avatar_default"))
        doctorNameLabel.text = vm.docName
        prescriptionLabel.isHidden = vm.isPrescription == 0
        jobTitleLabel.text = vm.deptName + "  " + vm.docJobTitle
        jobTitleLabel.adjustsFontSizeToFitWidth = true
        
        
        ///业务类型-1:咨询2:复诊
        if vm.businessType == 1 {
            businessTypeLabel.text = "咨询"
            prescriptionLabel.text = ""
            prescriptionLabel.isHidden = true
        }else if vm.businessType == 2{
            businessTypeLabel.text = "复诊"
            prescriptionLabel.text = "处方"
            prescriptionLabel.isHidden = false
        }
        
    }
    
    func updateDataForRegistration(vm: DoctorDetailViewModel) {
        arrowRight.isHidden = true
        avatarImgVieiw.kf.setImage(with: URL(string: vm.thumbnailUrl), placeholder: UIImage(named: "avatar_default"))
        doctorNameLabel.text = vm.doctorName
        prescriptionLabel.isHidden = vm.isPrescription == 0
        jobTitleLabel.text = vm.departmentName + "  " + vm.doctorOffice
        jobTitleLabel.adjustsFontSizeToFitWidth = true
    }
    @IBOutlet weak var arrowRight: UIImageView!
    
    @IBOutlet weak var avatarImgVieiw: UIImageView! {
        didSet {
            avatarImgVieiw.contentMode = .scaleAspectFill
            avatarImgVieiw.layer.cornerRadius = avatarImgVieiw.height / 2.0
            avatarImgVieiw.layer.masksToBounds = true
        }
    }
    @IBOutlet weak var doctorNameLabel: UILabel!
    @IBOutlet weak var prescriptionLabel: UILabel!{
        didSet {
            prescriptionLabel.layer.cornerRadius = 4
            prescriptionLabel.layer.borderColor = UIColor.splitLineLight.cgColor
            prescriptionLabel.layer.borderWidth = 1
        }
    }
    @IBOutlet weak var jobTitleLabel: UILabel!
    

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
